<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>GSoC2011SfM: D:/Travail/These/Determination caracteristiques camera/GSoC/SfM/src/PointOfView.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">GSoC2011SfM
   &#160;<span id="projectnumber">0.1</span>
   </div>
   <div id="projectbrief">Google Summer of Code 2011: Structure from motion</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">D:/Travail/These/Determination caracteristiques camera/GSoC/SfM/src/PointOfView.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef _GSOC_SFM_FIELD_OF_VIEW_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define _GSOC_SFM_FIELD_OF_VIEW_H 1</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span><span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="preprocessor">#include &quot;opencv2/core/core.hpp&quot;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;macro.h&quot;</span> <span class="comment">//SFM_EXPORTS</span>
<a name="l00009"></a>00009 <span class="comment">//#include &quot;Camera.h&quot;</span>
<a name="l00010"></a>00010 <span class="comment">//#include &quot;TracksOfPoints.h&quot;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="keyword">namespace </span>OpencvSfM{
<a name="l00014"></a>00014 
<a name="l00015"></a>00015   <span class="keyword">class </span>SFM_EXPORTS Camera;
<a name="l00016"></a>00016   <span class="keyword">class </span>SFM_EXPORTS TrackOfPoints;
<a name="l00017"></a>00017 
<a name="l00018"></a>00018   <span class="keyword">enum</span> paramsToEstimate
<a name="l00019"></a>00019   {
<a name="l00020"></a>00020     ROTATION_OK=1,    
<a name="l00021"></a>00021     TRANSLATION_OK=2 
<a name="l00022"></a>00022   };
<a name="l00023"></a>00023 
<a name="l00044"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html">00044</a>   <span class="keyword">class </span>SFM_EXPORTS <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html" title="This class represent the 3D position of the device which take the pictures. The role of the class is ...">PointOfView</a>
<a name="l00045"></a>00045   {
<a name="l00046"></a>00046   <span class="keyword">protected</span>:
<a name="l00047"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a4593900dcb330a47fdb5a7a1c4e2ad93">00047</a>     cv::Mat <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a4593900dcb330a47fdb5a7a1c4e2ad93" title="Rotation matrix R ( data is stored into projection_matrix_ )">rotation_</a>;
<a name="l00048"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#acd8ff3683942c1a8afed7b4f266eaa20">00048</a>     cv::Mat <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#acd8ff3683942c1a8afed7b4f266eaa20" title="Translation vector t ( Matrix instead of vector because data is stored into projection_matrix_ )...">translation_</a>;
<a name="l00049"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a920f9386c300582a19e68908654d169c">00049</a>     cv::Mat <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a920f9386c300582a19e68908654d169c" title="redundancy but speed improvement">projection_matrix_</a>;
<a name="l00050"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a83bfd58fd1074d5950dad2be9630dbf8">00050</a>     cv::Ptr&lt;Camera&gt; <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a83bfd58fd1074d5950dad2be9630dbf8" title="intra parameters and distortion coefs">device_</a>;
<a name="l00051"></a>00051 
<a name="l00052"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#ac644fc5f92709b33a31ee2370365f104">00052</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#ac644fc5f92709b33a31ee2370365f104" title="This attribut is used to know what we should estimate... If equal to 0, nothing should be estimated...">config_</a>;
<a name="l00053"></a>00053 
<a name="l00054"></a>00054   <span class="keyword">public</span>:
<a name="l00063"></a>00063     <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html" title="This class represent the 3D position of the device which take the pictures. The role of the class is ...">PointOfView</a>( cv::Ptr&lt;Camera&gt; device,cv::Mat rotation=cv::Mat::eye( 3, 3, CV_64F ),cv::Vec3d translation=cv::Vec3d( 0.0,0.0,0.0 ));
<a name="l00070"></a>00070     <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html" title="This class represent the 3D position of the device which take the pictures. The role of the class is ...">PointOfView</a>( cv::Mat projection_matrix );
<a name="l00074"></a>00074     <span class="keyword">virtual</span> ~<a class="code" href="class_opencv_sf_m_1_1_point_of_view.html" title="This class represent the 3D position of the device which take the pictures. The role of the class is ...">PointOfView</a>( <span class="keywordtype">void</span> );
<a name="l00075"></a>00075 
<a name="l00080"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#ae5de2e16eac553ea1e1e7501e009bbbd">00080</a>     cv::Ptr&lt;Camera&gt; <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#ae5de2e16eac553ea1e1e7501e009bbbd">getIntraParameters</a>( )<span class="keyword"> const</span>{<span class="keywordflow">return</span> device_;};
<a name="l00081"></a>00081     
<a name="l00087"></a>00087     <span class="keyword">virtual</span> std::vector&lt;cv::Vec2d&gt; project3DPointsIntoImage( std::vector&lt;TrackOfPoints&gt; points ) <span class="keyword">const</span>;
<a name="l00093"></a>00093     <span class="keyword">virtual</span> std::vector&lt;cv::Vec2d&gt; project3DPointsIntoImage( std::vector&lt;cv::Vec3d&gt; points ) <span class="keyword">const</span>;
<a name="l00099"></a>00099     <span class="keyword">virtual</span> cv::Vec2d project3DPointIntoImage( cv::Vec3d point ) <span class="keyword">const</span>;
<a name="l00105"></a>00105     <span class="keyword">virtual</span> <span class="keywordtype">bool</span> pointInFrontOfCamera( cv::Vec4d point ) <span class="keyword">const</span>;
<a name="l00110"></a>00110     <span class="keyword">virtual</span> cv::Mat getProjectionMatrix( ) <span class="keyword">const</span>;
<a name="l00111"></a>00111 
<a name="l00116"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#af13aa49ebfdb95b056b20825b00d3866">00116</a>     <span class="keyword">inline</span> cv::Mat getRotationMatrix( )<span class="keyword"> const</span>
<a name="l00117"></a>00117 <span class="keyword">    </span>{
<a name="l00118"></a>00118       <span class="keywordflow">return</span> rotation_;
<a name="l00119"></a>00119     };
<a name="l00124"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#ac1214c5bae587207ed0347b364e4d01e">00124</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> setRotationMatrix( cv::Mat newRot )
<a name="l00125"></a>00125     {
<a name="l00126"></a>00126       <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i&lt;3; ++i )
<a name="l00127"></a>00127         <span class="keywordflow">for</span>( <span class="keywordtype">int</span> j=0; j&lt;3; ++j )
<a name="l00128"></a>00128           rotation_.at&lt;<span class="keywordtype">double</span>&gt;( i,j ) = newRot.at&lt;<span class="keywordtype">double</span>&gt;( i,j );
<a name="l00129"></a>00129     };
<a name="l00130"></a>00130     
<a name="l00135"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a79b41aa3dc0ff0f7f5c0d821a8688f1f">00135</a>     <span class="keyword">inline</span> cv::Mat getTranslationVector( )<span class="keyword"> const</span>
<a name="l00136"></a>00136 <span class="keyword">    </span>{
<a name="l00137"></a>00137       <span class="keywordflow">return</span> translation_;
<a name="l00138"></a>00138     };
<a name="l00143"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#aa6402d155df7941da9b500d2f174ed1f">00143</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> setTranslationVector( cv::Mat newVect )
<a name="l00144"></a>00144     {
<a name="l00145"></a>00145       <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i=0; i&lt;3; ++i )
<a name="l00146"></a>00146         translation_.at&lt;<span class="keywordtype">double</span>&gt;( i,0 ) = newVect.at&lt;<span class="keywordtype">double</span>&gt;( i,0 );
<a name="l00147"></a>00147     };
<a name="l00148"></a>00148 
<a name="l00153"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a175d0cafda2105941a61a69dbd2fb538">00153</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a175d0cafda2105941a61a69dbd2fb538">rotationAroundX</a>( <span class="keywordtype">double</span> angle ) {
<a name="l00154"></a>00154         <span class="keywordtype">double</span> c = cos( angle ), s = sin( angle );
<a name="l00155"></a>00155         <span class="keywordtype">double</span> data[ ] = {1,  0,  0, 0,  c, -s, 0,  s,  c};
<a name="l00156"></a>00156         cv::Mat R( 3,3,CV_64F,data );
<a name="l00157"></a>00157         rotation_ *= R;
<a name="l00158"></a>00158     }
<a name="l00163"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a1575b171547fd61b486552c7160c9ef9">00163</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#a1575b171547fd61b486552c7160c9ef9">rotationAroundY</a>( <span class="keywordtype">double</span> angle ) {
<a name="l00164"></a>00164       <span class="keywordtype">double</span> c = cos( angle ), s = sin( angle );
<a name="l00165"></a>00165       <span class="keywordtype">double</span> data[ ] = {c, 0, s, 0, 1, 0, -s, 0, c};
<a name="l00166"></a>00166       cv::Mat R( 3,3,CV_64F,data );
<a name="l00167"></a>00167       rotation_ *= R;
<a name="l00168"></a>00168     }
<a name="l00173"></a><a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#ab290671dd21f78ae900e8926feb6fe7a">00173</a>     <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html#ab290671dd21f78ae900e8926feb6fe7a">rotationAroundZ</a>( <span class="keywordtype">double</span> angle ) {
<a name="l00174"></a>00174       <span class="keywordtype">double</span> c = cos( angle ), s = sin( angle );
<a name="l00175"></a>00175       <span class="keywordtype">double</span> data[ ] = {c, -s,  0, s,  c,  0, 0,  0,  1};
<a name="l00176"></a>00176       cv::Mat R( 3,3,CV_64F,data );
<a name="l00177"></a>00177       rotation_ *= R;
<a name="l00178"></a>00178     }
<a name="l00179"></a>00179     
<a name="l00184"></a>00184     <span class="keyword">static</span> cv::Ptr&lt;PointOfView&gt; read( <span class="keyword">const</span> cv::FileNode&amp; node );
<a name="l00185"></a>00185     
<a name="l00191"></a>00191     <span class="keyword">static</span> <span class="keywordtype">void</span> write( cv::FileStorage&amp; fs, <span class="keyword">const</span> <a class="code" href="class_opencv_sf_m_1_1_point_of_view.html" title="This class represent the 3D position of the device which take the pictures. The role of the class is ...">PointOfView</a>&amp; points );
<a name="l00192"></a>00192 
<a name="l00193"></a>00193   };
<a name="l00194"></a>00194 
<a name="l00195"></a>00195 }
<a name="l00196"></a>00196 
<a name="l00197"></a>00197 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Sun Aug 21 2011 16:45:52 for GSoC2011SfM by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
